package com.wenx.study;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.ForkJoinTask;
import java.util.concurrent.RecursiveAction;

/**
 * Created by Think on 2018/11/25.
 */
public class ForkJoin {

    public static void main(String[] args) {

        ForkJoinPool forkJoinPool = new ForkJoinPool();

        ForkJoinTask forkJoinTask = forkJoinPool.submit(new RecursiveAction() {
            @Override
            protected void compute() {
                System.out.println("fork/join执行任务");
            }
        });

        //forkJoinTask.join();
        try {
            forkJoinTask.get();
        } catch (InterruptedException e) {
            e.printStackTrace();
        } catch (ExecutionException e) {
            e.printStackTrace();
        }

    }

}
